
#include <BLabel>
#include <BGridLayout>
#include <BVBoxLayout>
#include <BHBoxLayout>
#include <BStyle>
#include <BPainter>
#include <BStyle>
#include <BFont>
#include <BStackLayout>

#include "Board.h"

Board::Board(BWidget* parent) : BGroupBox(parent)
{
	this->setTitleAlign(Align_Center);

	BHBoxLayout* titleLayout = new BHBoxLayout();
	{
		_foldeButton = new BButton();
		_foldeButton->setCheckable(true);
		_foldeButton->setAlign(Align_Center);
		_foldeButton->setForm(Form_IconAlone);
		_foldeButton->setGraph(Graph_Minus);
		_foldeButton->setIconSize(12);
		_foldeButton->setFixedSize(16);

		titleLayout->addWidget(_foldeButton);
		titleLayout->addSpring();
		titleLayout->setMargin(5);
	}
	this->setLayout(titleLayout, Part_Top);

	connect(_foldeButton, Signal_Checked, &Board::slotFoldeButtonChecked);
}
Board::~Board()
{

}

void Board::slotFoldeButtonChecked(const BObject* object, const BValue& value)
{
	bool checked = value;
	if (checked)
		_foldeButton->setGraph(Graph_Plus);
	else
		_foldeButton->setGraph(Graph_Minus);
	this->setFolded(checked);
}
